#! /bin/sh

get_lk() {
  livekit_cli=$(curl -s https://api.github.com/repos/livekit/livekit-cli/tags | jq -r '.[0].name')
  repo="livekit/livekit-cli"
  cli=lk_2.2.1_linux_amd64.tar.gz
  cli_name="lk"
  sudo rm -rf /usr/local/bin/${cli_name}
  mkdir demo && cd demo
  wget https://ghproxy.net/https://github.com/${repo}/releases/download/${livekit_cli}/${cli}
  tar -zxvf ${cli}
  sudo mv ${cli_name} /usr/local/bin/
  cd ..
  rm -rf demo

}
get_lk
